package com.voxel.sense.infomsg.module.user.personal.setting;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.example.com.common.app.BViewActivity;
import com.example.com.common.view.dialog.DialogCallBack;
import com.example.com.common.view.dialog.IDialog;
import com.voxel.sense.infomsg.App;
import com.voxel.sense.infomsg.R;
import com.voxel.sense.infomsg.activity.MsgReminderActivity;

import butterknife.OnClick;

/**
 * Created by ChenYiYao on 2018/4/12.
 */

public class SettingActivity extends BViewActivity<SettingContract.Presenter> implements SettingContract.View {

    public static void show(Context c) {
        c.startActivity(new Intent(c, SettingActivity.class));
    }

    @Override
    protected SettingContract.Presenter initPresenter() {
        return new SettingPresenter(this);
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_setting;
    }

    @OnClick({R.id.ll_message_item, R.id.ll_logout_item, R.id.ll_close_item})
    void onViewclick(View v) {
        switch (v.getId()) {
            case R.id.ll_message_item:
                MsgReminderActivity.show(this);
                break;
            case R.id.ll_logout_item://登出账号
                IDialog.getInstance().showChooseDialog(this, "", "是否要退出账号", new DialogCallBack() {
                    @Override
                    public void onClick(int what) {
                        if (IDialog.YES == what) {
                            App.getInstance().logout(0);
                        }
                    }
                });
                break;
            case R.id.ll_close_item://关闭程序
                IDialog.getInstance().showChooseDialog(this, "", "是否要退出账号", new DialogCallBack() {
                    @Override
                    public void onClick(int what) {
                        if (IDialog.YES == what) {
                            App.getInstance().exitApp();
                        }
                    }
                });
                break;
        }
    }
}
